$(function(){
	$("#VendorSpinner").change(function(){
		var id = $("#VendorSpinner").val();
		location.href = projectName+"/pay.do?method=2&id="+id;
		/*$.ajax({
			type:"POST",
			url:projectName+"/bill.do",
			dataType:"json",
			contentType:"application/x-www-form-urlencoded; charset=utf-8",
			async:false,
			data:"method=2&id="+id,
			success:function(data){
				location.reload();
			},
			error:function(){
				
			}
		});*/
	});

	$.ajax({
		type:"POST",
		url:"SystemConfig",
		data:"method=7",
		dataType:"json",
		contentType:"application/x-www-form-urlencoded; charset=utf-8",
		success:function(data){
			var src = "<option value='0'>供货商</option>";
			for(var count in data){
					src += "<option value='"+data[count].id+"'>"+data[count].vendor+"</option>";
				}
				$("#VendorSpinner").html(src);
				if(vendorIds != undefined && vendorIds != "" && vendorIds != null){
					$("#VendorSpinner").val(vendorIds);
				}
				
			},
			error:function(data){
				alert("error:"+data);
			}
		});
});
function toDataPage(currentPage){
	var id = $("#VendorSpinner").val();
	location.href = projectName+"/pay.do?method=2&id="+id+"&currentPage="+currentPage;
}


$(function(){
	$("#address").click(function(){
		$("#payBill").click(function(){
			$(".paidFlag-checkbox").each(function(i,e){
				//判断当前e元素有没有选中【0：未选中  1：选中】，
				//如果是未选中，读取该行的输入框值  
				var billId = $(this).parent().prev().prev().prev().prev().attr("billId");
				var falg = 0;
				var content = "";
				if($(e).is(':checked')){
					falg = 1;
				}else{
					falg = 0;
					content = $(e).parent().parent().find("td").find(".content-check").val();
				}
				$.ajax({
					type:"POST",
					url:"SystemConfig",
					dataType:"json",
					contentType:"application/x-www-form-urlencoded; charset=utf-8",
					async:false,
					data:"method=9&falg="+falg+"&content="+content+"&billId="+billId,
					success:function(data){
						location.reload();
					},
					error:function(){
						alert("支付失败");
					}
				});
	//			alert($(e).parent().parent().html());
	//			1，“” - 0，“89898” - 0，“89898”
			});
		});
	});
});
